package ch2;

import java.util.Scanner;

public class YouKes {//游客那题：一个景区根据游人的年龄收取不同价格的门票。请编写游人类，根据年龄段决定能够购买的门票价格并输出

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (true) {
            System.out.print("请输入游客姓名：");
            String b = input.next();
            if (b.equals("n")) {
                return;
            }
            YouKe a = new YouKe();
            a.name = b;
            System.out.println("请输入游客年龄：");
            a.age = input.nextInt();
            int piaojia = a.calcPrize();
            System.out.println("这个游客" + a.name + ",年龄" + a.age + "，应付票价" + piaojia + "元");
        }
    }
}
